home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12251 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news1.erols.com!newsmaster@erols.com
  2. From: "Stephen C. Marney" <scmarney@erols.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How Do I Color A Button?
  5. Date: Mon, 18 Mar 1996 17:39:47 -0500
  6. Organization: Techsyn Company
  7. Message-ID: <314DE633.5BF4@erols.com>
  8. References: <4ik07d$7nj@cliffy.lfwc.lockheed.com>
  9. NNTP-Posting-Host: as6s48.erols.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. James Bassett wrote:
  16. > Need to know how to color a button in a dialog box. I have tried using
  17. > SetBkColor, FillRect and CBrush class but with no results. HELP
  18. >                                         Jim Bassett
  19.  
  20. >From MFC FAQ (courtesy of Scot Wingo): (Get it, the FAQ!)
  21.  
  22. 6.2.6.  How do I change the background color of a control?
  23.  
  24. Your dialog can trap the WM_CTLCOLOR message, look up the MFC help file notes for CWnd::OnCtlColor().  Before a 
  25. control is about to paint itself, the parent window receives a chance to set its own default text color and 
  26. background brush.
  27.  
  28. jmccabe@portage1.portup.com, mfc-l, 7/18/95
  29.  
  30. Also check out the MS KB article  ID: Q117778 TITLE: Changing the Background Color of an MFC Edit Control.
  31.  
  32. Ramesh, MSMFC, 7/19/95
  33.  
  34. 6.2.9.  How do I change the background color of a BUTTON???
  35.  
  36.  NOTE: THE METHOD IN 6.2.6 WILL NOT WORK FOR BUTTONS!
  37.  
  38. If you want to change the color of a dialog button, you have to use owner-draw button. (you can use bitmap 
  39. buttons) Changing the color through  OnCtlColor() will not work for buttons. The following Knowledge Base  
  40. articles (GO MSKB on CIS) may be of help to you.
  41.  
  42.    ID: Q32685
  43.    TITLE: Using the WM_CTLCOLOR Message
  44.  
  45.  
  46.  
  47.    ID: Q64328
  48.    SAMPLE: Owner-Draw: 3-D Push Button Made from Bitmaps with Text
  49.  
  50.    This article explains sample code for a owner-draw button.
  51.  
  52. Ramesh, NetQuest., MSMFC, 8/3/95
  53.  
  54.